// 轮播图模型
const { Banner } = require('../../../models/banner');
// 统一数据返回类
const { DataReturn } = require('../../../common/returnclass');

/**
 * @api {Get} /banners 获取轮播图
 * @apiGroup Admin-Banners
 *
 * @apiSuccess {Array} banner_url 轮播图地址
 */
module.exports = async (req, res) => {

	let banners = await Banner.findOne();
	if (!banners) return DataReturn.getData(res, 200, [], '暂无数据');
	DataReturn.getData(res, 200, banners, '获取轮播图数据成功')
	

}
